package fun.tan90.easy.binlog.base.enums;

import lombok.Getter;

/**
 * description TODO
 * company 铁人科技
 *
 * @author 陈浩杰
 * @date 2023/12/18 15:32
 */
@Getter
public enum OutputTypeEnum {

    MQTT("1", "mqtt"),

    WEBHOOK("2", "webhook"),

    KAFKA("3", "kafka"),

    ROCKETMQ("4", "rocketmq"),

    MYSQL("5", "mysql"),

    REDIS_SINGLE("60", "redis-single"),

    REDIS_SENTINEL("61", "redis-sentinel"),

    REDIS_CLUSTER("62", "redis-cluster"),
    ;

    private final String outputType;

    private final String output;

    OutputTypeEnum(String outputType, String output) {
        this.outputType = outputType;
        this.output = output;
    }

    public static OutputTypeEnum outputType(String outputType) {
        if (outputType == null || outputType.isEmpty()) {
            return null;
        }
        for (OutputTypeEnum outputTypeEnum : OutputTypeEnum.values()) {
            if (outputType.equals(outputTypeEnum.getOutputType())) {
                return outputTypeEnum;
            }
        }
        return null;
    }
}
